import { requestV2 } from '@/utils/request';
import { CustomerEditState } from './data.d';

// 1.1 查询客户列表
export async function query(params?: any) {
  return requestV2('customer/list', {
    params,
  });
}

// 1.2 添加客户信息
export async function add(params?: any) {
  return requestV2.post('customer/add', params, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

// 1.3 编辑客户信息
export async function update(params: CustomerEditState, onlySwitch?: boolean) {
  return requestV2.put('customer/update', params, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

// 1.3 删除客户信息
export async function del(params?: any) {
  return requestV2.delete('customer/delete', {
    params,
  });
}